//
//  LySearchView.swift
//  SinaWeibo
//
//  Created by 蒋琪 on 2017/5/24.
//  Copyright © 2017年 liuying. All rights reserved.
//

import UIKit

class LySearchView: UIButton {

   //当视图被激活的时候
    override func awakeFromNib() {
        //设置图片内边距
        self.imageEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)
        //设置文字的内编剧
        self.titleEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 0)
        //设置宽度
        self.bounds.size.width = UIScreen.main.bounds.width
        //设置圆角
        self.layer.cornerRadius = 17
        //控件默认开启
        //self.layer.masksToBounds = true
    }
    
    
    //定义类方法,加载该视图的nib文件
    class func loadSearchView() -> LySearchView{
        
        let nib = UINib(nibName: "LySearchView", bundle: nil)
        let searchV = nib.instantiate(withOwner: nil, options: nil).last as! LySearchView
        return searchV
        
    }

}
